home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / pack / comp.sys.handhelds_3402_000000.msg
Internet Message Format  |  1995-03-31  |  4KB

  1. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!spool2.mu.edu!sdd.hp.com!hp-pcd!hpcvra.cv.hp.com!rnews!hpcvbbs!akcs.joehorn
  2. From: akcs.joehorn@hpcvbbs.UUCP (Joseph K. Horn)
  3. Newsgroups: comp.sys.handhelds
  4. Subject: Program Packing
  5. Keywords: pack syseval
  6. Message-ID: <2793c672:1720comp.sys.handhelds@hpcvbbs.UUCP>
  7. Date: 16 Jan 91 03:40:06 GMT
  8. Lines: 86
  9.  
  10. PACK, a program packer, by Joseph K. Horn.
  11.  
  12. Purpose: Shrinks and speeds up programs that contain SYSEVALs.  Has no
  13. effect on programs that do not contain SYSEVALs.
  14.  
  15. Instructions: Recall program object to the stack.  Run PACK.  Store the
  16. new program object into a new name or into its old variable name if so
  17. desired. The newly PACKed program will be shorter and run faster than
  18. the old one.
  19.  
  20. Theory: The SYSEVAL instruction takes a binary integer as its argument. 
  21. But a binary integer followed by SYSEVAL takes up 31 nibbles, and can be
  22. replaced by just the leading five nibbles of the binary integer.  Such
  23. replacement not only uses less memory, but runs faster.  Unfortunately,
  24. these objects do not have names, and show up in listings as "External",
  25. rendering the program unreadable and uneditable.  But it runs just fine.
  26.  
  27. Note well: PACK was intended for use on programs, but performs the same
  28. packing on lists.  If a list contains a binary integer immediately
  29. followed by a SYSEVAL, both will be replaced by the equivalent External
  30. object.
  31.  
  32. PACK should only be used on the final version of a program, because once
  33. a program contains External objects, it is not editable by normal
  34. methods.  A good practice might be to keep an "original version" with
  35. SYSEVALs, and a "working copy" PACKed and ready to use, in two separate
  36. variables.
  37.  
  38. EXAMPLE 1:  You wish to make a key assignment that puts you into the
  39. hidden directory.  Let's put it on the POLAR key.  Normally you'd do
  40. this:
  41.  
  42.      {  <<  HOME  #15777h  SYSEVAL  >>  82.3  }
  43.  
  44. and then press STOK (in the blue-CST menu).  That would work.  But
  45. before you press STOK, run PACK; the list becomes { << HOME External >>
  46. 82.3 } because the address #15777h and the SYSEVAL got replaced by the
  47. equivalent External object.  Now press STOK, and the assignment will be
  48. 26 nibbles shorter and a little bit faster.  (If you actually did this
  49. example, you may delete this key assignment, if you wish, by typing 82.3
  50. and pressing DELK.)
  51.  
  52. EXAMPLE 2:  You have a program that looks like this:
  53.  
  54. <<  #18CD7 SYSEVAL  #21922 SYSEVAL  #3DEF SYSEVAL  #62F89 SYSEVAL  >>
  55.  
  56. It takes a port number (0, 1 or 2) and recalls that port's objects onto
  57. the stack.  It is 72 bytes long (checksum: #CBDAh).  PACK it, and it
  58. shrinks to only 20 bytes long, but is no longer readable or editable.
  59.  
  60. Here is 'PACK' in Bill Wickes ASC-> form.  Download it into PACK, run
  61. ASC-> on it, and store it back into PACK.
  62.  
  63. %%HP:;
  64. "D9D20E1632D9D202BA81AD2A18DA16D9D20FD55035040C1C1612040CCD207200
  65. 08F14660CC8FB9760D81431301691746E50B2130D9D208813020950FD5502C23
  66. 0F6E30C1C1632230CCD20C50008F14660CC8FB9760D8143130169174143131AE
  67. 015B03103A6A31939EA903170A6A148161170CD56D8D34150B2130B9F06B2130
  68. 3303278BF1C2A2052000030303030303030303030354235314134BAC178BF1D5
  69. 032D9D202ABF133920100000000000061090DA19C2A2DBBF1C58C1E0CF178BF1
  70. 803A2A9CF1D13A290DA178BF1803A276BA1C58C1DBBF1803A25BCF1339201000
  71. 00000000061076BA1FDAA1C58C176BA176BA1B2130496328DBF1D9D202BA812B
  72. F81D0040D9D205D55022650C1C16226509FF306C426CCD20D80008F14660CC8F
  73. B9760D814313016817414313117716017114B31149EED13103B6A45331909E6C
  74. 215006910B6A31509E68130AA0A1500CD5AB8D341508F2D7603468F01808E300
  75. 40C9B26B9F06B2130B213093632B2130253F"
  76.  
  77. Here is 'PACK' in UUENCODED form for THOSE people...
  78.  
  79. ----------------------cut here--------------------------
  80. begin 600 pack
  81. M2%!(4#0X+4&=+>!A(YTM(*L8VJ*!K6&=+?!=!5-`P,%A(4#`W`(G`(`?9`;,
  82. M^)MGT!@T,1"6<61>L!(#G2V`&`,"6?!=!<(R\.8#'!PV(@/,+<`%`/A!9L",
  83. MOWD&C4$3`V$91T$3$^H0M3`!HZ83.>F:,'&@ID$8%G'`7=;80U&P$@.;#[82
  84. M`S,P<K@?+"I0`@`P,#`P,#`P,#`P,$4R-4$QM,IQN!]=,-+9`J+[,9,"`0``
  85. M````8`$)K9$L*KW[P84<#OQQN!\(HZ+)'QVCDM`:A_N!,"IGJ\&%'+W[@3`J
  86. MM?PQDP(!``````!@`6>K\:T:7,AQMAIGJ[$2`Y0V@KT?G2T@JQBRC]$`!)TM
  87. M4%T%(E;`P6$B5I#_`\8DQMP"C0"`'V0&S/B;9]`8-#$0AG$4-#$1=V$0%T$[
  88. M$93N'1,P:THU$PGIQA(%8!FPIA,%Z88QH`H:!<!=NMA#48`O?09#A@^!@#X`
  89. 0!)PKMOE@*S&P$@,Y-K(2`P'Y
  90. `
  91. end
  92. ----------------------cut here--------------------------
  93.  
  94. Thanks to Rick Grevelle & Derek Nickel for the tools used here.
  95.  
  96. --  Joseph K. Horn  --  (714) 858-0920  --  Peripheral Vision, Ltd.  --
  97.